﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace Business.Models
{
    public class MonHoc
    {
        [Key]
        public int IdMonHoc { get; set; }
        public string TenMonHoc { get; set; }
        public int IdKhoiLop { get; set; } 
        [ForeignKey("IdKhoiLop")] 
        public virtual KhoiLop KhoiLop { get; set; }
        public bool HoatDong { get; set; }
        public int IdNhanVien { get; set; }
        [ForeignKey("IdNhanVien")]
        public virtual QuanTri QuanTri { get; set; }
    }
    public class MonHocConfiguration : EntityTypeConfiguration<MonHoc>
    {

        public MonHocConfiguration()
            : base()
        {

            HasKey(d => d.IdMonHoc);
            Property(d => d.IdMonHoc).
                HasColumnName("IdMonHoc").
                HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity).
                IsRequired();
            Property(d => d.IdKhoiLop).HasColumnName("KhoiLop"); 
            ToTable("MonHoc", "dbo");
        }

    }
}